<template>
  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <el-table-column label="序号" align="center" type="index" />
      <el-table-column label="订单编号" align="center" prop="orderId" />
      <el-table-column label="规格型号" align="center" prop="type" />
      <el-table-column label="内码" align="center" prop="internalCode" />
      <el-table-column label="成品码" align="center" prop="productionCode" />
      <el-table-column
        label="最后一次集采时间"
        align="center"
        prop="lastCollectionTime"
        :formatter="dateFormatter"
        width="180px"
      />
    </el-table>
    <!-- 分页 -->
    <Pagination
      :total="total"
      v-model:page="queryParams.pageNo"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
  </ContentWrap>

</template>

<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import { DeliveryReceiptDetailApi, DeliveryReceiptDetailVO } from '@/api/hcxly/deliveryreceiptdetail'

/** 拨交单明细 列表 */
defineOptions({ name: 'DeliveryReceiptDetail' })

const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化

const loading = ref(true) // 列表的加载中
const list = ref<DeliveryReceiptDetailVO[]>([]) // 列表的数据
const total = ref(0) // 列表的总页数
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  deliveryReceiptId: undefined,
  orderId: undefined,
  internalCode: undefined,
  productionCode: undefined,
  type: undefined,
  lastCollectionTime: [],
  outDeptId: undefined,
  outDeptName: undefined,
  recvDeptId: undefined,
  recvDeptName: undefined,
  submitTime: [],
  remark: undefined,
  createTime: []
})
const queryFormRef = ref() // 搜索的表单


/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    const data = await DeliveryReceiptDetailApi.getDeliveryReceiptDetailPage(queryParams)
    list.value = data.list
    total.value = data.total
  } finally {
    loading.value = false
  }
}

/** 初始化 **/
onMounted(() => {
  getList()
})
</script>
